package org.colafries.admin.entity.domain.index;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
* 逻辑事实表
*
* @author Ann
* @since 2024-06-03
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName(value = "t_idx_logic_fact_table")
public class LogicFactTable implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 逻辑表id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 逻辑表code
     */
    @TableField("code")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long code;

    /**
     * 版本
     */
    @TableField("version")
    private Integer version;

    /**
     * 逻辑表英文名
     */
    @TableField("logic_table_name")
    private String logicTableName;

    /**
     * 逻辑表名称
     */
    @TableField("logic_table_alias")
    private String logicTableAlias;

    /**
     * 逻辑事实表主键
     */
    @TableField("logic_primary_key")
    private String logicPrimaryKey;

    /**
     * 数据源id
     */
    @TableField("source_db_id")
    private Integer sourceDbId;

    /**
     * schema
     */
    @TableField("source_schema")
    private String sourceSchema;

    /**
     * 来源表
     */
    @TableField("source_table_name")
    private String sourceTableName;

    /**
     * SQL筛选条件
     */
    @TableField("expression")
    private String expression;

    /**
     * 自定义表id
     */
    @TableField("custom_table_id")
    private Integer customTableId;

    /**
     * 创建时间
     */
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    /**
     * 修改时间
     */
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    /**
     * 创建人
     */
    @TableField("create_user")
    private String createUser;

    /**
     * 修改人
     */
    @TableField("update_user")
    private String updateUser;

}
